package com.atguigu.gmall.order.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import lombok.Data;

/**
 * 订单表 订单表
 * @TableName order_info
 */
@TableName(value ="order_info") //写逻辑表名即可
@Data
public class OrderInfo implements Serializable {
    /**
     * 编号
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 收货人
     */
    @TableField(value = "consignee")
    private String consignee;

    /**
     * 收件人电话
     */
    @TableField(value = "consignee_tel")
    private String consigneeTel;

    /**
     * 总金额
     */
    @TableField(value = "total_amount")
    private BigDecimal totalAmount;

    /**
     * 订单状态
     */
    @TableField(value = "order_status")
    private String orderStatus;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 付款方式
     */
    @TableField(value = "payment_way")
    private String paymentWay;

    /**
     * 送货地址
     */
    @TableField(value = "delivery_address")
    private String deliveryAddress;

    /**
     * 订单备注
     */
    @TableField(value = "order_comment")
    private String orderComment;

    /**
     * 订单交易编号（第三方支付用)
     */
    @TableField(value = "out_trade_no")
    private String outTradeNo;

    /**
     * 订单描述(第三方支付用)
     */
    @TableField(value = "trade_body")
    private String tradeBody;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 失效时间
     */
    @TableField(value = "expire_time")
    private Date expireTime;

    /**
     * 进度状态
     */
    @TableField(value = "process_status")
    private String processStatus;

    /**
     * 物流单编号
     */
    @TableField(value = "tracking_no")
    private String trackingNo;

    /**
     * 父订单编号
     */
    @TableField(value = "parent_order_id")
    private Long parentOrderId;

    /**
     * 图片路径
     */
    @TableField(value = "img_url")
    private String imgUrl;

    /**
     * 省id
     */
    @TableField(value = "province_id")
    private Long provinceId;

    /**
     * 操作时间
     */
    @TableField(value = "operate_time")
    private Date operateTime;

    /**
     * 促销金额
     */
    @TableField(value = "activity_reduce_amount")
    private BigDecimal activityReduceAmount;

    /**
     * 优惠券金额
     */
    @TableField(value = "coupon_amount")
    private BigDecimal couponAmount;

    /**
     * 原价金额
     */
    @TableField(value = "original_total_amount")
    private BigDecimal originalTotalAmount;

    /**
     * 运费
     */
    @TableField(value = "feight_fee")
    private BigDecimal feightFee;

    /**
     * 可退款日期（签收后30天）
     */
    @TableField(value = "refundable_time")
    private Date refundableTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @TableField(exist = false)
    private List<OrderDetail> orderDetails;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        OrderInfo other = (OrderInfo) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getConsignee() == null ? other.getConsignee() == null : this.getConsignee().equals(other.getConsignee()))
            && (this.getConsigneeTel() == null ? other.getConsigneeTel() == null : this.getConsigneeTel().equals(other.getConsigneeTel()))
            && (this.getTotalAmount() == null ? other.getTotalAmount() == null : this.getTotalAmount().equals(other.getTotalAmount()))
            && (this.getOrderStatus() == null ? other.getOrderStatus() == null : this.getOrderStatus().equals(other.getOrderStatus()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getPaymentWay() == null ? other.getPaymentWay() == null : this.getPaymentWay().equals(other.getPaymentWay()))
            && (this.getDeliveryAddress() == null ? other.getDeliveryAddress() == null : this.getDeliveryAddress().equals(other.getDeliveryAddress()))
            && (this.getOrderComment() == null ? other.getOrderComment() == null : this.getOrderComment().equals(other.getOrderComment()))
            && (this.getOutTradeNo() == null ? other.getOutTradeNo() == null : this.getOutTradeNo().equals(other.getOutTradeNo()))
            && (this.getTradeBody() == null ? other.getTradeBody() == null : this.getTradeBody().equals(other.getTradeBody()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
            && (this.getProcessStatus() == null ? other.getProcessStatus() == null : this.getProcessStatus().equals(other.getProcessStatus()))
            && (this.getTrackingNo() == null ? other.getTrackingNo() == null : this.getTrackingNo().equals(other.getTrackingNo()))
            && (this.getParentOrderId() == null ? other.getParentOrderId() == null : this.getParentOrderId().equals(other.getParentOrderId()))
            && (this.getImgUrl() == null ? other.getImgUrl() == null : this.getImgUrl().equals(other.getImgUrl()))
            && (this.getProvinceId() == null ? other.getProvinceId() == null : this.getProvinceId().equals(other.getProvinceId()))
            && (this.getOperateTime() == null ? other.getOperateTime() == null : this.getOperateTime().equals(other.getOperateTime()))
            && (this.getActivityReduceAmount() == null ? other.getActivityReduceAmount() == null : this.getActivityReduceAmount().equals(other.getActivityReduceAmount()))
            && (this.getCouponAmount() == null ? other.getCouponAmount() == null : this.getCouponAmount().equals(other.getCouponAmount()))
            && (this.getOriginalTotalAmount() == null ? other.getOriginalTotalAmount() == null : this.getOriginalTotalAmount().equals(other.getOriginalTotalAmount()))
            && (this.getFeightFee() == null ? other.getFeightFee() == null : this.getFeightFee().equals(other.getFeightFee()))
            && (this.getRefundableTime() == null ? other.getRefundableTime() == null : this.getRefundableTime().equals(other.getRefundableTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getConsignee() == null) ? 0 : getConsignee().hashCode());
        result = prime * result + ((getConsigneeTel() == null) ? 0 : getConsigneeTel().hashCode());
        result = prime * result + ((getTotalAmount() == null) ? 0 : getTotalAmount().hashCode());
        result = prime * result + ((getOrderStatus() == null) ? 0 : getOrderStatus().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getPaymentWay() == null) ? 0 : getPaymentWay().hashCode());
        result = prime * result + ((getDeliveryAddress() == null) ? 0 : getDeliveryAddress().hashCode());
        result = prime * result + ((getOrderComment() == null) ? 0 : getOrderComment().hashCode());
        result = prime * result + ((getOutTradeNo() == null) ? 0 : getOutTradeNo().hashCode());
        result = prime * result + ((getTradeBody() == null) ? 0 : getTradeBody().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
        result = prime * result + ((getProcessStatus() == null) ? 0 : getProcessStatus().hashCode());
        result = prime * result + ((getTrackingNo() == null) ? 0 : getTrackingNo().hashCode());
        result = prime * result + ((getParentOrderId() == null) ? 0 : getParentOrderId().hashCode());
        result = prime * result + ((getImgUrl() == null) ? 0 : getImgUrl().hashCode());
        result = prime * result + ((getProvinceId() == null) ? 0 : getProvinceId().hashCode());
        result = prime * result + ((getOperateTime() == null) ? 0 : getOperateTime().hashCode());
        result = prime * result + ((getActivityReduceAmount() == null) ? 0 : getActivityReduceAmount().hashCode());
        result = prime * result + ((getCouponAmount() == null) ? 0 : getCouponAmount().hashCode());
        result = prime * result + ((getOriginalTotalAmount() == null) ? 0 : getOriginalTotalAmount().hashCode());
        result = prime * result + ((getFeightFee() == null) ? 0 : getFeightFee().hashCode());
        result = prime * result + ((getRefundableTime() == null) ? 0 : getRefundableTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", consignee=").append(consignee);
        sb.append(", consigneeTel=").append(consigneeTel);
        sb.append(", totalAmount=").append(totalAmount);
        sb.append(", orderStatus=").append(orderStatus);
        sb.append(", userId=").append(userId);
        sb.append(", paymentWay=").append(paymentWay);
        sb.append(", deliveryAddress=").append(deliveryAddress);
        sb.append(", orderComment=").append(orderComment);
        sb.append(", outTradeNo=").append(outTradeNo);
        sb.append(", tradeBody=").append(tradeBody);
        sb.append(", createTime=").append(createTime);
        sb.append(", expireTime=").append(expireTime);
        sb.append(", processStatus=").append(processStatus);
        sb.append(", trackingNo=").append(trackingNo);
        sb.append(", parentOrderId=").append(parentOrderId);
        sb.append(", imgUrl=").append(imgUrl);
        sb.append(", provinceId=").append(provinceId);
        sb.append(", operateTime=").append(operateTime);
        sb.append(", activityReduceAmount=").append(activityReduceAmount);
        sb.append(", couponAmount=").append(couponAmount);
        sb.append(", originalTotalAmount=").append(originalTotalAmount);
        sb.append(", feightFee=").append(feightFee);
        sb.append(", refundableTime=").append(refundableTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}